using System.Data;
using System.Data.SqlClient;
namespace VanTaiData
{
    public class clsTMContController
    {
        private clsConnect cls = new clsConnect();

        #region[GetData]
        public DataTable BindGirdTMCont()
        {
            return cls.BindGridData("sp_TMCont");
        }
        public DataTable BindGirdTMCont_Detail_Edit(int id)
        {
            return cls.LayDuLieuParameter("sp_TMCont_Detail_Edit", "@Id", id);
        }
        #endregion

        #region[Insert-Update-Delete]
        public bool InsertTMCont(clsTMContProperty data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Cont_Alias", data.Cont_Alias);
            cls.AddParameter("@Cont_Name", data.Cont_Name);
            cls.AddParameter("@Cont_Note", data.Cont_Note);
            cls.ExecuteNonQuery("sp_TMCont_Insert");
            return true;
        }
        public bool UpdateTMCont(clsTMContProperty data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Cont_ID", data.Cont_ID);
            cls.AddParameter("@Cont_Alias", data.Cont_Alias);
            cls.AddParameter("@Cont_Name", data.Cont_Name);
            cls.AddParameter("@Cont_Note", data.Cont_Note);
            cls.ExecuteNonQuery("sp_TMCont_Update");
            return true;
        }
        public bool DeleteTMCont(int id)
        {
            cls.Delete("sp_TMCont_Delete", "@Cont_ID", id);
            return true;
        }
        #endregion

        #region[Search-Fillter]
        public DataTable Search(string keywords)
        {
            return cls.Search("sp_TMCont_Search", "@KEYWORDS", keywords);
        }
        #endregion
    }
}